// Internal action code for project traffic_control_jason

package my;

import java.util.Random;

import jason.asSemantics.*;
import jason.asSyntax.*;

@SuppressWarnings("serial")
public class select_semaphore extends DefaultInternalAction {

    @Override
    public Object execute(TransitionSystem ts, Unifier un, Term[] terms) throws Exception {
    	
    	//right,left or up,down can be allowed at once for now (RANDOMICALLY)
		Random r = new Random();
		if(r.nextInt(10) <= 5) {
			//choosed right,left
	        return un.unifies(terms[0], new Atom("left")) & un.unifies(terms[1], new Atom("right"));
		} else {
			//choosed up,down
	        return un.unifies(terms[0], new Atom("up")) & un.unifies(terms[1], new Atom("down"));
		}    	
    }

}
